package com.superman.supermarket.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.superman.supermarket.client.event.PageJumpEvent.PageJumpEventHandler;

/**
 * 页面跳转事件
 * 
 * @author superman
 * @version 2018年7月12日下午4:21:31
 */
public class PageJumpEvent extends GwtEvent<PageJumpEventHandler> {

	/**
	 * 事件处理器
	 * 
	 * @author superman
	 * @version 2018年7月12日下午4:22:00
	 */
	public interface PageJumpEventHandler extends EventHandler {

		/**
		 * 跳转
		 * 
		 * @author superman
		 * @version 2018年8月6日 下午9:21:19
		 * @param url
		 */
		void jump(String url);

	}

	public static final Type<PageJumpEventHandler> TYPE = new Type<PageJumpEventHandler>();

	private String url;

	public PageJumpEvent(String url) {
		this.url = url;
	}

	@Override
	protected void dispatch(PageJumpEventHandler handler) {
		handler.jump(url);
	}

	@Override
	public Type<PageJumpEventHandler> getAssociatedType() {
		return TYPE;
	}

}
